<?php
require('../../../class2.php');
require('../library/admin/adminapi.php');

if(!getperms('P')){header('location:'.e_BASE.'index.php'); exit; }
require_once(e_ADMIN.'auth.php');
                
        $ns->tablerender("<center>".lan_admin_manage_order_feature_manage);

$sql->db_Select($e107shop_db_name['orders'], "*");
if($row=$sql->db_Fetch()) {
    do {
        $product = $row["productID"];
        $sql2->db_Select($e107shop_db_name['products'], "*", "ID=".$product);
        while($row2=$sql2->db_Fetch()) {
        
            //
            // Store the fields in variables so they can be
            // used in the form, without having to write out the
            // form twice.
            //
            $fname_1 = $row2["fname_1"];            
            $fname_2 = $row2["fname_2"];            
            $fname_3 = $row2["fname_3"];            
            $fname_4 = $row2["fname_4"];            
            $fname_5 = $row2["fname_5"];            
            $fname_6 = $row2["fname_6"];            
            $fname_7 = $row2["fname_7"];            
            $fname_8 = $row2["fname_8"];            
            $fname_9 = $row2["fname_9"];            
            $fname_10 = $row2["fname_10"];            
            $fname_11 = $row2["fname_11"];            
            $fname_12 = $row2["fname_12"];            
            $fname_13 = $row2["fname_13"];            
            $fname_14 = $row2["fname_14"];            
            $fname_15 = $row2["fname_15"];            
            $fname_16 = $row2["fname_16"];            
            $fname_17 = $row2["fname_17"];            
            $fname_18 = $row2["fname_18"];            
            $fname_19 = $row2["fname_19"];            
            $fname_20 = $row2["fname_20"];
            $product_name = $row2["product_name"];
            $field1 = $row["field1"];
            $field2 = $row["field2"];        
            $field3 = $row["field3"];
            $field4 = $row["field4"];
            $field5 = $row["field5"];
            $field6 = $row["field6"];
            $field7 = $row["field7"];
            $field8 = $row["field8"];            
            $field9 = $row["field9"];            
            $field10 = $row["field10"];            
            $field11 = $row["field11"];
            $field12 = $row["field12"];
            $field13 = $row["field13"];
            $field14 = $row["field14"];
            $field15 = $row["field15"];
            $field16 = $row["field16"];
            $field17 = $row["field17"];
            $field18 = $row["field18"];
            $field19 = $row["field19"];
            $field20 = $row["field20"];
            $userid = $row["theuser"];
            $status = $row["status"];
            $order_number = $row["order_number"];

              echo "<table class='fborder' width='95%'>
                    <tr>
                          <td colspan='6'><center><b>$product_name</b></center></td>
                    </tr>
                    <tr>
                          <td rowspan='8' class='forumheader2' width='15%'><center>
                          <b>Username:</b><br />$userid<br /><br />
                          <input class=\"tbox\" input type='button' name='invoice' value='"
                          .lan_admin_feature_invoice."' OnClick='invoice();'><br />
                          ($order_number)<br /><br />
                          <b>Status:</b><br />
                          $status
                          </center></td>
                          <td class='forumheader2' height='5%'><b>$fname_1</b></td>
                          <td class='forumheader2'><b>$fname_2</b></td>
                          <td class='forumheader2'><b>$fname_3</b></td>
                          <td class='forumheader2'><b>$fname_4</b></td>
                          <td class='forumheader2'><b>$fname_5</b></td>
                    </tr>
                    <tr>
                          <td class='forumheader3'>$field1</td>
                          <td class='forumheader3'>$field2</td>
                          <td class='forumheader3'>$field3</td>
                          <td class='forumheader3'>$field4</td>
                          <td class='forumheader3'>$field5</td>
                    </tr>  
                    <tr>
                          <td class='forumheader2'><b>$fname_6</b></td>
                          <td class='forumheader2'><b>$fname_7</b></td>
                          <td class='forumheader2'><b>$fname_8</b></td>
                          <td class='forumheader2'><b>$fname_9</b></td>
                          <td class='forumheader2'><b>$fname_10</b></td>
                    </tr>
                    <tr>
                          <td class='forumheader3'>$field6</td>
                          <td class='forumheader3'>$field7</td>
                          <td class='forumheader3'>$field8</td>
                          <td class='forumheader3'>$field9</td>
                          <td class='forumheader3'>$field10</td>
                    </tr>
                    <tr>
                          <td class='forumheader2'><b>$fname_11</b></td>
                          <td class='forumheader2'><b>$fname_12</b></td>
                          <td class='forumheader2'><b>$fname_13</b></td>
                          <td class='forumheader2'><b>$fname_14</b></td>
                          <td class='forumheader2'><b>$fname_15</b></td>
                    </tr>
                    <tr>
                          <td class='forumheader3'>$field11</td>
                          <td class='forumheader3'>$field12</td>
                          <td class='forumheader3'>$field13</td>
                          <td class='forumheader3'>$field14</td>
                          <td class='forumheader3'>$field15</td>
                    </tr>
                    <tr>
                          <td class='forumheader2'><b>$fname_16</b></td>
                          <td class='forumheader2'><b>$fname_17</b></td>
                          <td class='forumheader2'><b>$fname_18</b></td>
                          <td class='forumheader2'><b>$fname_19</b></td>
                          <td class='forumheader2'><b>$fname_20</b></td>
                    </tr>
                    <tr>
                          <td class='forumheader3'>$field16</td>
                          <td class='forumheader3'>$field17</td>
                          <td class='forumheader3'>$field18</td>
                          <td class='forumheader3'>$field19</td>
                          <td class='forumheader3'>$field20</td>
                    </tr>
            </table><br />";
         }
  }
  
  while ($row=$sql->db_Fetch());

} else {
    echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".lan_admin_manage_order_feature_empty."<br />";
}

?>
<script language="Javascript">
function invoice() {
    window.open("../invoice.php?o=<?=$order_number?>", "invoice");
}
</script>
<?php
require_once(e_ADMIN.'footer.php');
